package com.ddwl.data.job;

import com.ddwl.data.service.OperateLogService;
import com.xxl.job.core.biz.model.ReturnT;
import com.xxl.job.core.handler.annotation.XxlJob;
import com.xxl.job.core.log.XxlJobLogger;
import org.springframework.stereotype.Component;

import javax.annotation.Resource;

/**
 * @Author hemiaojun
 * @Date 2021/3/10 17:05
 */
@Component
public class OperateLogJob {

    @Resource
    private OperateLogService operateLogService;


    /**
     * 删除8天之前的操作日志
     * @param param
     * @return
     */
    @XxlJob("deleteOperateLog")
    public ReturnT<String> deleteOperateLog(String param){
        XxlJobLogger.log("开始执行删除操作日志任务");
        try{
            operateLogService.deleteOperateLog();
        }catch (Exception e){
            XxlJobLogger.log("deleteOperateLog error",e);
            return ReturnT.FAIL;
        }
        return ReturnT.SUCCESS;
    }

}
